package com.card.hwatt.entity;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.OneToOne;
import javax.persistence.Table;

import org.hibernate.annotations.GenericGenerator;

/**
 * 部门
 * 
 * @author Administrator
 * 
 */
@Entity
@Table(name = "KQZ_Brch")
public class Department {

	@Id
	@GeneratedValue(generator = "generator", strategy = GenerationType.AUTO)
	@GenericGenerator(name = "generator", strategy = "native")
	@Column(name = "BrchID")
	public Long id;

	@Column(name = "PID")
	public Long parentId;

	@Column(name = "BrchName", length = 200, nullable = false)
	public String name;

	@Column(name = "BrchOrder")
	public int orderBy;

	@Column(name = "PARENTBRCHID", length = 200)
	public String path;
	
	@OneToOne(cascade = { CascadeType.ALL, CascadeType.REMOVE }, mappedBy = "department")
	@JoinColumn(nullable = false)
	public Company company;
}
